<?php get_header(); ?>
<div class="top">
    <div class="feature_box">
        <div class="slider gen">
        	<div class="slider1 rounded">
                <div id="slider">
                    <?php $feature = new WP_query(); $feature->query('showposts='.$mytheme['f_cat_posts'].'&cat='.$mytheme['featured_cat'].''); ?>
                    <?php while ($feature->have_posts()) : $feature->the_post(); ?>
                      <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php slider_img(431,226); ?></a>
                    <?php endwhile; ?>
                </div>
            </div>    
        </div><!--/slider-->
        <div class="top_cats gen">
            <div id="top_cats" class="rounded">
                <ul>
                    <?php
					$t_cat = $mytheme['t_cat'];
					if (is_array($t_cat)) {
					foreach ($t_cat as $tcat) { 
					query_posts("showposts=1&cat=$tcat");
					?>
						<?php while (have_posts()) : the_post(); ?>
                          <li>
                          <h3><a href="<?php echo get_category_link($tcat); ?>"><?php echo get_cat_name($tcat); ?></a></h3>
                          <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php slider_img(138,80); ?></a>
                          <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
                          </li>
                        <?php endwhile; ?>
					<?php }} else { ?>
					<!--nothing-->
					<?php } ?>
                </ul>
            </div>
        </div><!--/top cats-->
        <script type="text/javascript">
			jQuery(function() {
				jQuery("#top_cats").jCarouselLite({
				mouseWheel: true,
				<?php if($mytheme['enable_scroll'] != ''): ?>
				auto: 800,
				<?php endif; ?>
				visible:3,
				speed: 2000
				});
			});
		</script>
    </div><!--/feature box-->
    <div class="latest gen">
    	<ul id="latest" class="rounded">
        	<?php if($mytheme['latest_title'] != ''): ?>
            	<li class="title"><?php print $mytheme['latest_title']; ?></li>
            <?php endif; ?>
        	<?php $latest = new WP_query(); $latest->query('showposts='.$mytheme['latest_posts'].''); ?>
			<?php while ($latest->have_posts()) : $latest->the_post(); ?>
              <li>
              <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
              </li>
            <?php endwhile; wp_reset_query(); ?>
        </ul>
    </div><!--/latest news-->
    <div class="large_banners">
        <?php if ( ! dynamic_sidebar( 'large_banners' ) ) : ?><?php endif; // end large banners widget area ?>
    </div><!--/large banner(s)-->
    <div class="clear"></div>
</div><!--/top-->
<div class="main">
	<?php
	$main_cat = $mytheme['m_cat'];
	if (is_array($main_cat)) {
	foreach ($main_cat as $mcat) { 
	query_posts("showposts=1&cat=$mcat");
    ?>
		<?php if ( have_posts() ) : ?>
        <div class="cat_bottom">
            <div class="cat_top">
                <div class="cat_title">
                    <h4><a href="<?php echo get_category_link($mcat); ?>"><?php echo get_cat_name($mcat); ?></a></h4>
                    <ul>
                        <?php wp_list_categories('title_li=&child_of='.$mcat.'&depth=1'); ?> 
                    </ul>
                </div><!--/category title-->
                <div class="cat_content">
                    <?php while (have_posts()) : the_post(); ?>
                    <div>
                        <?php img(130,100); ?>
                        <h4 ><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h4>
                        <p><?php excerpt(30); ?></p>
                    </div>
                    <?php endwhile; //end first news ?>
                    <?php if ( have_posts() ) : ?>
                    <ul class="other">
                        <?php $more = new WP_query(); $more->query("showposts=1&cat=$mcat&offset=1"); ?>
                        <?php while ($more->have_posts()) : $more->the_post(); ?>
                        <li>
                        <?php img(40,40); ?>
                        <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ?></a></li>
                        <?php endwhile; ?>
                        <?php $more = new WP_query(); $more->query("showposts=3&cat=$mcat&offset=2"); ?>
                        <?php while ($more->have_posts()) : $more->the_post(); ?>
                        <li class="clear" ><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'vnh' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title() ?></a></li>
                        <?php endwhile; ?>
                    </ul><!--/other news-->
                    <?php endif; wp_reset_query(); ?>
                </div><!--/content-->
            </div>
        </div><?php endif; //end category ?>
	<?php }} else { ?>
    <!--nothing-->
    <?php } ?>
</div><!--/main-->
<?php get_sidebar(1); ?> 
<?php get_sidebar(2); ?> 
<?php get_footer(); ?>
